#include<assert.h>
#include<stdlib.h>
#include<stdio.h>
int compare_int(const void *a, const void *b)
{
	assert(a);
	assert(b);
	return (*(int*)a - *(int*)b);
}

int compare1_float(const void *a, const void *b)
{
	assert(a);
	assert(b);
	return (*(float*)a - *(float*)b);
}

int compare1_double(const void *a, const void *b)
{
	assert(a);
	assert(b);
	return (*(double*)a - *(double*)b);
}

int main()
{
	int arr_int[] = { 1, 5, 7, 6, 2, 12, 56, 18, 79 };
	float   arr_float[] = { 1.0f,21.0f,89.0f,65.0f,56.0f,24.0f,31.0f,45.0f };
	double arr_double[] = { 1.0,5.0,7.0,6.0,2.0,12.0,56.0,18.0,79.0 };

	void(*ptrArr[4])() = {0,compare_int ,compare1_float ,compare1_double };
	qsort(arr_int, 9, sizeof(int), ptrArr[1]);
	qsort(arr_float, 8, sizeof(float), ptrArr[2]);
	qsort(arr_double, 9, sizeof(double), ptrArr[3]);
	for (int i = 0; i < 9; i++)
	{
		printf("%4d", arr_int[i]);
	}
	printf("\n");
	for (int i = 0; i < 8; i++)
	{
		printf("%.1f  ", arr_float[i]);
	}
	printf("\n");
	for (int i = 0; i < 9; i++)
	{
		printf("%lf  ", arr_double[i]);
	}
	printf("\n");
	return 0;
}